// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLExpr_ptr;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLExportTableStatement.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../../../utils/listTran.h"
#include "SQLExprTableSource.h"
#include "SQLAssignItem.h"

SQLExportTableStatement::SQLExportTableStatement()
{
  dbType = DbType_ptr(new DbType(&DbType::hive));
  partition = std::make_shared<std::list<SQLAssignItem_ptr>>();
}

SQLExprTableSource_ptr SQLExportTableStatement::getTable()
{
  return table;
}

void SQLExportTableStatement::setTable(SQLExprTableSource_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLExportTableStatement));
  }
  this->table = x;
}

SQLAssignItem_list_ptr SQLExportTableStatement::getPartition()
{
  return partition;
}

SQLExpr_ptr SQLExportTableStatement::getTo()
{
  return to;
}

void SQLExportTableStatement::setTo(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLExportTableStatement));
  }
  this->to = x;
}

SQLExpr_ptr SQLExportTableStatement::getForReplication()
{
  return forReplication;
}

void SQLExportTableStatement::setForReplication(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLExportTableStatement));
  }
  this->forReplication = x;
}

void SQLExportTableStatement::accept0(SQLASTVisitor_ptr v)
{
  if (v->visit(SharedObject(SQLExportTableStatement)))
  {
    acceptChild(v, table);
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLAssignItem, SQLObject>(partition);
    acceptChild(v, tmp);
    acceptChild(v, to);
    acceptChild(v, forReplication);
  }
  v->endVisit(SharedObject(SQLExportTableStatement));
}
